# Short Description: Manages tools that appear midway of the client tab
# Long Description:
#  The NavTool extension is an official extension of MuIDE
#  It manages weather or not to display the native NavTools
#  NavTools are listbook entries that appear between input and output
#      on the Mu* Client tab
#  It also configures these tools via a config file in libs/extentions/config
#      which dictates how they operate
#  It ALSO is INTENDED to provide a controlling access to remove and add
#      non native NavTool extensions to the ui
#
#  Defualt at client start: Not used, the widgets are displayed but he ui doesnt know 
#      how to handle them
#  If loaded before a connection exists, some tools may get an ExtensionError
#
# EOD
#
# Requires: briefs.rb
NAV_TOOLS = ["IM","Mail","Inventory","Exits","About me"]
class NavTools
  attr_accessor :gui,:listbook,:tools
  def initialize(gui)
# setup native navtool extensions
    @tools = NAV_TOOLS
    @gui,@listbook = gui,gui.m_listbook2
# p @gui.client
# exit
    
  end
  def remove_tool(tool)
    page = @tools.index[tool]
    @listbook.remove_page page
    @tools.delete_at page
  end
# this is to add non native tools
# panel is expected to be a class that handles everything!!!!
  def add_tool(tool,panel)
    @tools << tool
    @listbook.add_page panel
  end
  # this will setup what the widgets are meant to do and updating
  def configure(file)
    eval File.open(file,"r").readlines.join
  end
end
@NavToolHandler = NavTools::new self